#include "Device.h"
#include "PCInterrupt.h"
#include "IRController.h"
#include "myHardware.h"

int key;

IRController controller;

void setup() {
  Serial.begin(9600);
   int res = controller.begin(IR_PIN, OTHER_DEVICE);
  if (res != SUCCESS) {
    Serial.println("IRController error"); 
    Serial.println(res);
  }
}

void loop() {
  key = controller.read();

  if (key >= 0) 
  {
    Serial.print("Key=");
    Serial.println(key);
    Serial.println();
  }

  delay(500);                  // 2 cycle delay to cancel duplicate keypresses
}

